﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Resources;
using C1.Silverlight.Pdf;
using MyFloridaHouse.libSvUtilities.Logging;

namespace MyFloridaHouse.libSvOpenDistricts.PDF
{
    public static class HouseMapLogo
    {
        public static void Draw(C1PdfDocument pdf, PDFPoint cursor, double borderWidth, double borderHeight)
        {
            // draw border 
            //Pen logoPen = new Pen(Colors.Black, 1.0);
            //pdf.DrawRectangle(logoPen, new Rect(cursor.x, cursor.y, borderWidth, borderHeight));

            // Draw word to fit
            List<PDFString> stringList = new List<PDFString>();
            PDFString Line1 = new PDFString(pdf, "Arial", 1, PdfFontStyle.Bold, Colors.Red, "Florida House of Representatives", 0); 
            stringList.Add(Line1);
            PDFString Line2 = new PDFString(pdf, "Arial", 1, PdfFontStyle.Regular, Colors.Red, "Redistricting Committee", 0);
            stringList.Add(Line2);
            PDFString Line3 = new PDFString(pdf, "Arial", 1, PdfFontStyle.Regular, Colors.Black, "402 S. Monroe Street", 0);
            stringList.Add(Line3);
            PDFString Line4 = new PDFString(pdf, "Arial", 1, PdfFontStyle.Regular, Colors.Black, "House Office Building", 0);
            stringList.Add(Line4);
            PDFString Line5 = new PDFString(pdf, "Arial", 1, PdfFontStyle.Regular, Colors.Black, "Tallahassee, FL 32399", 0);
            stringList.Add(Line5);
            PDFString Line6 = new PDFString(pdf, "Arial", 1, PdfFontStyle.Regular, Colors.Black, "www.floridaredistricting.org", 0);
            stringList.Add(Line6);

            double logoTextPadding = borderHeight * .02;
            double logoTextWidth = borderWidth;
            logoTextPadding = PDFdoc.SetStringListFontSizeToFit(stringList, logoTextWidth, borderHeight, logoTextPadding);

            PDFPoint headingCursor = new PDFPoint(cursor);
            headingCursor.AddY(logoTextPadding);
            foreach (var line in stringList)
            {
                line.DrawCenteredX(new Rect(headingCursor.x, headingCursor.y, logoTextWidth, line.textBoxSize.Height));
                headingCursor.AddY(Line1.textBoxSize.Height + logoTextPadding);
            }

        }
    }
}
